#-*- coding: utf8 -*-
from tutor.scripts import *
from tutor.plugins.sympy import *

def dot_prod(u, v):
    return sum(ui * vi for (ui, vi) in zip(u, v))

while True:
    # Entradas
    with display_block('Entradas'):
        A = One * oneof(-1, 1) * oneof(1, 2, 3, 4, 5, 6, 8)
        B = One * oneof(-1, 1) * oneof(1, 2, 3, 4, 5, 6, 8)
        if A == B:
            continue
        elif A > B:
            A, B = B, A
        a = 1 / (2 * (A + B))

    with display_block('Distratores'):
        _ans = set([a])

        while len(_ans) < 8:
            _x = oneof(_ans)
            _x *= (One * oneof(-1, 1) * oneof(1, 1, 2, 3, 4, 5)) / oneof(1, 1, 2, 3, 4, 5)
            if _x not in _ans:
                _ans.add(_x)
        _ans.discard(a)
        correta = a
        distr1, distr2, distr3, distr4, distr5, distr6, distr7 = _ans

    break

